/*
 * \brief  Server-side interface for Nitpicker view
 * \author Norman Feske
 * \date   2006-08-23
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__NITPICKER_VIEW__SERVER_H_
#define _INCLUDE__NITPICKER_VIEW__SERVER_H_

#include <nitpicker_view/nitpicker_view.h>
#include <base/server.h>

namespace Nitpicker {

	class View_server : public Genode::Server_object, public View
	{
		public:

			int dispatch(int op, Genode::Ipc_istream &is, Genode::Ipc_ostream &os)
			{
				switch (op) {

				case VIEWPORT:
					{
						int x = 0, y = 0, w = 0, h = 0, buf_x = 0, buf_y = 0;
						bool redraw = false;
						is >> x >> y >> w >> h >> buf_x >> buf_y >> redraw;
						return viewport(x, y, w, h, buf_x, buf_y, redraw);
					}

				case STACK:
					{
						View_capability neighbor;
						bool behind = false, redraw = false;
						is >> neighbor >> behind >> redraw;
						return stack(neighbor, behind, redraw);
					}

				case TITLE:
					{
						Genode::Buffer title_buf;
						is >> title_buf;
						return title(title_buf.addr());
					}

				default:

					return -1;
				}
			}
	};
}

#endif /* _INCLUDE__NITPICKER_VIEW__SERVER_H_ */
